﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace agvcontroller.Common
{
    public class CJob
    {
        public string ID
        {
            get;
            set;
        }

        public int Source
        {
            get;
            set;
        }

        public int Dest
        {
            get;
            set;
        }

        public int Priority
        {
            get;
            set;
        }

        public string CarrierID
        {
            get;
            set;
        }

        public DateTime QueuedTime
        {
            get;
            set;
        }

        public DateTime StartTime
        {
            get;
            set;
        }

        public enumJobState State
        {
            get;
            set;
        }

        public string Type
        {
            get;
            set;
        }

        public List<CVehicleJob> VehicleJobList;

        public CJob()
        {
            VehicleJobList = new List<CVehicleJob>();
        }

        ~CJob()
        {
            VehicleJobList.Clear();
            VehicleJobList = null;
        }
    }

    public class CJobDic : Dictionary<string, CJob>
    {
        private static CJobDic uniqueInstance;

        public static CJobDic getInstance()
        {
            if (uniqueInstance == null)
            {
                uniqueInstance = new CJobDic();
            }
            return uniqueInstance;
        }

        public int AddJob(CJob job)
        { 
            //whether add job or not

            this.Add(job.ID, job);

            return CReturnCode.SUCCESS;
        }

        
    }
}
